/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.GUI.sidepanels;

import java.util.Observable;
import java.util.Observer;
import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
 *
 * @author Jelle
 */
public class ObserverTabbedPane extends JTabbedPane implements Observer, ChangeListener {
    RunPanel rp;
    public ObserverTabbedPane(RunPanel rp) {
        this.addChangeListener(this);
        this.rp = rp;

    }

    public void update(Observable o, Object arg) {
        CustomArgument carg = (CustomArgument) arg;
        setSelectedIndex(Integer.parseInt(carg.getStringArgument()));
    }

    public void stateChanged(ChangeEvent e) {
        if(this.getSelectedIndex()==2){
            rp.createStoresTable();
        }
    }
}
